/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.easoft.code.pos.data.pojos;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author Eliu
 */
@Entity
@Table(name = "pos_impresora")
@NamedQueries({
    @NamedQuery(name = "PosImpresora.findAll", query = "SELECT p FROM PosImpresora p"),
    @NamedQuery(name = "PosImpresora.findByNombre", query = "SELECT p FROM PosImpresora p WHERE p.nombre = :nombre"),
    @NamedQuery(name = "PosImpresora.findByDireccion", query = "SELECT p FROM PosImpresora p WHERE p.direccion = :direccion")})
public class PosImpresora implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "nombre", nullable = false, length = 100)
    private String nombre;
    @Column(name = "direccion", length = 200)
    private String direccion;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "posImpresora")
    private Collection<PosCaja> posCajaCollection;

    public PosImpresora() {
    }

    public PosImpresora(String nombre) {
        this.nombre = nombre;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public String getDireccion() {
        return direccion;
    }

    public void setDireccion(String direccion) {
        this.direccion = direccion;
    }

    public Collection<PosCaja> getPosCajaCollection() {
        return posCajaCollection;
    }

    public void setPosCajaCollection(Collection<PosCaja> posCajaCollection) {
        this.posCajaCollection = posCajaCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (nombre != null ? nombre.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof PosImpresora)) {
            return false;
        }
        PosImpresora other = (PosImpresora) object;
        if ((this.nombre == null && other.nombre != null) || (this.nombre != null && !this.nombre.equals(other.nombre))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return nombre;
    }
}
